#include "fxcc/core/graph/opengl3/ssao/GBufferEffect.h"

using namespace fxcc::graph::opengl3::ssao;

GBufferEffect::GBufferEffect()
    : fxcc::graph::opengl3::Effect3d(FragCode()) {

    m_PipeLineType.m_RasterizerType = fxcc::graph::common::RasterizerType::_NONE_;
    m_PipeLineType.m_DepthStencilType = fxcc::graph::common::DepthStencilType::_DEPTH_LESS_STENCIL_NONE;

      };

std::string fxcc::graph::opengl3::ssao::GBufferEffect::FragCode()
{
    //struct VertexOut
    //{
    //    vec4 Position;
    //    vec3 NativePos;
    //    vec3 FragPos;
    //    vec2 TexCoords;
    //    vec3 Normal;
    //    vec4 ViewFragPos;
    //    vec3 ViewNormal;
    //};

    return R"(
layout (location = 0) out vec3 gViewFragPosition;
layout (location = 1) out vec3 gViewNormal;
layout (location = 2) out vec3 gAlbedo;


void main()
{    
    
    // store the fragment position vector in the first gbuffer texture
    vec4 FragViewPos=passData.view * vec4(  vOut.FragPos,1.0f);
    gViewFragPosition.xyz = FragViewPos.xyz;
    // also store the per-fragment normals into the gbuffer
    gViewNormal.xyz = normalize(vOut.ViewNormal);

    // and the diffuse per-fragment color
    gAlbedo.rgb = vec3(0.95);


}  
    )";


}
int fxcc::graph::opengl3::ssao::GBufferEffect::GetNumTextures()
{
    return 6;
}
;